package com.springboot.demo.autoconfig;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

@SuppressWarnings("unused")
public class CustomCommandLineRunner implements CommandLineRunner {
    Environment environment;

    public CustomCommandLineRunner(Environment environment) {
        this.environment = environment;
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("Using Spring Boot to generate CommandLineRunner. ");
        System.out.println("Generate a random string: ".concat(Objects.requireNonNull(environment.getProperty("random."))));
    }

}
